//
//  TETabBarViewController.m
//  TintExample
//
//  Created by Kevin Wu on 6/6/12.
//  Copyright (c) 2012 Telligenty. All rights reserved.
//

#import "TETabBarViewController.h"



@implementation TETabBarViewController

- (void)loadView {
    [super loadView];
    
    TTTabBar *tabBar = [[TTTabBar alloc] init];
    tabBar.frame = TTRectMake(40.0, 10.0, 240.0, 60.0);
    tabBar.delegate = self;
    [self.view addSubview:tabBar];
    
    
    UIImage *bg1 = [UIImage imageWithColor:[UIColor grayColor] size:TTSizeSquare(60.0)];
    UIImage *bg2 = [UIImage imageWithColor:[UIColor redColor] size:TTSizeSquare(60.0)];
    
    UIImage *img11 = [bg1 mergeAtCenterWithImage:[UIImage imageNamed:@"calculator.png"]];
    UIImage *img12 = [bg2 mergeAtCenterWithImage:[UIImage imageNamed:@"calculator.png"]];
    UIImage *img21 = [bg1 mergeAtCenterWithImage:[UIImage imageNamed:@"camera.png"]];
    UIImage *img22 = [bg2 mergeAtCenterWithImage:[UIImage imageNamed:@"camera.png"]];
    UIImage *img31 = [bg1 mergeAtCenterWithImage:[UIImage imageNamed:@"clock.png"]];
    UIImage *img32 = [bg2 mergeAtCenterWithImage:[UIImage imageNamed:@"clock.png"]];
    UIImage *img41 = [bg1 mergeAtCenterWithImage:[UIImage imageNamed:@"pencil.png"]];
    UIImage *img42 = [bg2 mergeAtCenterWithImage:[UIImage imageNamed:@"pencil.png"]];
    
    TTTab *tab1 = [TTTab tabWithNormalBackgroundImage:img11 
                             hilightedBackgroundImage:img12];
    TTTab *tab2 = [TTTab tabWithNormalBackgroundImage:img21 
                             hilightedBackgroundImage:img22];
    TTTab *tab3 = [TTTab tabWithNormalBackgroundImage:img31 
                             hilightedBackgroundImage:img32];
    TTTab *tab4 = [TTTab tabWithNormalBackgroundImage:img41 
                             hilightedBackgroundImage:img42];
    
    tabBar.tabs = [NSArray arrayWithObjects:tab1, tab2, tab3, tab4, nil];
    [tabBar selectTabAtIndex:1];
    
    
}

- (void)viewDidLoad {
    [super viewDidLoad];
}


#pragma mark - TTTabBarDelegate

- (void)tabBar:(TTTabBar *)tabBar didSelectTabAtIndex:(NSUInteger)index {
    TTDPRINT(@"%d", index);
}

@end
